// 页面路径：store/index.js 
import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex); //vue的插件机制
import tabBar from '@/utils/tabbar.js'
//Vuex.Store 构造器选项
const store = new Vuex.Store({
	state: { //存放状态
		IMAGE_URL: 'http://dn.fuliaoxx.com/',
		classobj: null,
		dpxsdata: {},
		tabBarList: [],
		roleId: 1, //1.客户，2销售，3老板
		tagarr: [],
		curcustomer: null,
		curaddr: null,
		curuser: null,
		anduser: null,
		curgoods:null,
		curyxkh:null
	},
	mutations: {
		getclassobj(state, obj) {
			state.classobj = obj
		},
		setdpxsdata(state, obj) {
			state.dpxsdata = obj
		},
		setRoleId(state, data) {
			state.roleId = data;
			uni.setStorageSync('loanroleId', data)
			state.tabBarList = tabBar[Number(data) - 1];
			uni.setStorageSync('tabBarList', tabBar[Number(data) - 1])
		},
		settagarr(state, arr) {
			state.tagarr = arr
		},
		setcustomer(state, obj) {
			state.curcustomer = obj;
		},
		setaddr(state, obj) {
			state.curaddr = obj;
		},
		setuser(state, obj) {
			state.curuser = obj;
		},
		setanduser(state, obj) {
			state.anduser = obj;
		},
		setgoods(state, obj) {
			state.curgoods = obj;
		},
		// curyxkh
		setyxkh(state, obj) {
			state.curyxkh = obj;
		},
	}
})
export default store